var ajaxHelper = require("../../utils/ajaxhelp");
let token = wx.getStorageSync('token');
const serviceUrl = getApp().globalData.serviceUrl;

const QueryCompetitorById = (competitorId) => {
	token = wx.getStorageSync('token');
	return ajaxHelper.promiseRequst(serviceUrl + "/api/Competitor/QueryCompetitorById", {
		'Authorization': 'Bearer ' + token
	}, "GET", {
		competitorId: competitorId
	})
}

const QueryCompetitor = (CompetitorView = {}) => {
	token = wx.getStorageSync('token');
	return ajaxHelper.promiseRequst(serviceUrl + "/api/Competitor/QueryCompetitor", {
		'Authorization': 'Bearer ' + token
	}, "POST", CompetitorView)
}

const SaveCompetitor = (CompetitorView = {}) => {
	token = wx.getStorageSync('token');
	return ajaxHelper.promiseRequst(serviceUrl + "/api/Competitor/SaveCompetitor", {
		'Authorization': 'Bearer ' + token
	}, "POST", CompetitorView)
}

const AddCompetitor = (CompetitorView = {}) => {
	token = wx.getStorageSync('token');
	return ajaxHelper.promiseRequst(serviceUrl + "/api/Competitor/AddCompetitor", {
		'Authorization': 'Bearer ' + token
	}, "POST", CompetitorView)
}
module.exports = {
	QueryCompetitor,
	QueryCompetitorById,
	SaveCompetitor,
	AddCompetitor
}
